//
//  GameMarketModel.swift
//  JunYiProject
//
//  Created by xiaogxjkz on 2021/6/10.
//

import UIKit

struct GameMarketModel: Codable {
    
    //交易日期 yyyy-MM-dd HH:mm:ss
    var day:String? = ""
    //开盘
    var open:String? = "0.0"
    //最高
    var high:String? = "0.0"
    //最低
    var low:String? = "0.0"
    //收盘
    var close:String? = "0.0"
    //成交量
    var volume:String? = "0.0"
    
    ///防止服务端下发字段多余当前字段，而无法匹配解析
    class GameMarketModel : Decodable {
        var day:String?
        var open:String?
        var high:String?
        var low:String?
        var close:String?
        var volume:String?
    }
    
}


extension GameMarketModel {
    
    /// 模型转字典
    /// - Returns: [String:Any]
    func modelToDictionary() -> [String:Any] {
        return [
            "day":self.day as Any,
            "open":self.open as Any,
            "high":self.high as Any,
            "low":self.low!,
            "close":self.close as Any,
            "volume":self.volume as Any,
        ]
    }
    
}
